home *** CD-ROM | disk | FTP | other *** search
- 'Script to test for adding vertices to the selected graphic
-
- Option Explicit
-
- Dim tcApp
-
- '================= Add Vertex the tail of collection
- Sub AddTail(tcVrts)
-
- Dim tcVrt
- Dim cnt
- Dim X
- Dim Y
- Dim Z
-
- cnt = tcVrts.Count
-
- Set tcVrt = tcVrts(cnt - 1)
- X = tcVrt.X + 1
- Y = tcVrt.y + 1
- z = tcVrt.z
-
- Set tcVrt = tcVrts.Add(x, y, z)
-
- MsgBox "Vertices count: " & CStr(tcVrts.Count) & " Vertex added to the " & CStr(tcVrt.Index)
-
- end sub
-
- '================= Add Vertex the head of collection
- Sub AddHead(tcVrts)
-
- Dim tcVrt
-
- Dim X
- Dim Y
- Dim Z
-
- Set tcVrt = tcVrts(0)
-
- X = tcVrt.X - 1
- Y = tcVrt.y - 1
- z = tcVrt.z
-
- Set tcVrt = tcVrts.Add(x, y, z, , , , , , , 0)
-
- MsgBox "Vertices count: " & CStr(tcVrts.Count) & " Vertex added to the " & CStr(tcVrt.Index)
-
-
- end sub
-
- '================= Add Vertex the middle of collection
- Sub AddMiddle(tcVrts)
-
- Dim tcVrt
-
- Dim tcVrt0
- Dim tcVrt1
-
- Dim X
- Dim Y
- Dim Z
-
- Set tcVrt0 = tcVrts(0)
- Set tcVrt1 = tcVrts(1)
-
- X = (tcVrt1.X + tcVrt0.X) / 2
- Y = (tcVrt1.y + tcVrt0.y) / 2
- z = (tcVrt1.z + tcVrt0.z) / 2
-
- Set tcVrt = tcVrts.Add(x, y, z, , , , , , , , tcVrt0)
-
- MsgBox "Vertices count: " & CStr(tcVrts.Count) & " Vertex added to the " & CStr(tcVrt.Index)
-
- end sub
-
- Sub Main()
-
- Dim cnt
- Dim tcSel
- Dim tcDwg
- Dim tcVrts
-
-
-
- Set tcSel = tcApp.Selection
- cnt = tcSel.Count
- MsgBox "Selection count: " & CStr(cnt)
-
- If (cnt <> 1) Then
- Exit Sub
- End If
-
- Set tcDwg = tcApp.ActiveDrawing
- Set tcVrts = tcSel(0).Vertices
-
- AddTail tcVrts
-
- AddHead tcVrts
-
- AddMiddle tcVrts
-
- tcSel(0).Closed = False
- tcSel(0).Select
- tcDwg.ActiveView.Refresh
- end sub
-
- Set tcApp = CreateObject("TurboCAD.Application")
- tcApp.Visible = True
-
- Main
-
- MsgBox "Done"
-